#include<bits/stdc++.h>
const int N = 16;
using namespace std;
//----------------------------------------------------------------------------//
int n = 16;
int st[N];
void dfs(int u)
{
	if (u > n)
	{
		int sum1 = 0, sum2 = 0, sq1 = 0, sq2 = 0, cub1 = 0, cub2 = 0;
		for (int i = 1; i <= n; i++)
		{
			if (st[i]) sum1 += i,sq1 += i * i,cub1 += i * i * i;
			else sum2 += i,sq2 += i * i,cub2 += i * i * i;
		}
		if (sum1 == sum2 && sq1 == sq2 && cub1 == cub2)
		{
			for (int i = 1; i <= n; i++)
			{
				if (st[i]==st[1]?1:0) cout << i << " ";
			}
			exit(0);
		}
		return ;
	}
	st[u] = 0;
	dfs(u + 1);
	st[u] = 1;
	dfs(u + 1);
	st[u] = 0;
}
int main()
{
	dfs(1);
}
